package org.example.chatservice.config;

import org.apache.kafka.clients.admin.NewTopic;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.kafka.config.TopicBuilder;

@Configuration
public class KafkaConfig {
    public static final String PRIVATE_CHAT_TOPIC = "private-messages";
    public static final String GROUP_CHAT_TOPIC = "group-messages";
    
    @Bean
    public NewTopic privateMessageTopic() {
        return TopicBuilder.name(PRIVATE_CHAT_TOPIC)
                .partitions(3)
                .replicas(1)
                .build();
    }

    @Bean
    public NewTopic groupMessageTopic() {
        return TopicBuilder.name(GROUP_CHAT_TOPIC)
                .partitions(3)
                .replicas(1)
                .build();
    }
}